Page({
        data: {
                user_id:"",
                xianshi:false
        },
        onLoad: function (options) {
                this.setData({
                        user_id:JSON.parse(decodeURIComponent(this.options.cc))
                })
                console.log(this.data.user_id)
                wx.setNavigationBarTitle({
                        title: '第三步'
                        })
        },
        back_home(e){
               var pwd = e.detail.value.id
               var id  = this.data.user_id
               console.log(pwd)
               console.log(id)
               wx.request({
                 url: 'http://localhost:3000/change_pwd',
                 method:"POST",
                 data:{
                        id: id,
                        pwd:pwd
                 },
                 success(res){
                         if(res.data == "修改成功"){
                                wx.showModal({  
                                        title: '密码设置成功，新密码为',  
                                        content: pwd,  
                                        success: function(res) {
                                        if (res.confirm) {  
                                        console.log('用户点击确定')  
                                        wx.navigateTo({
                                        url: '../../../login/login'
                                        })
                                        } else if (res.cancel) {  
                                        wx.navigateTo({
                                        url: '../../../login/login',
                                        }) 
                                        }  
                                        }       
                                })
                         } else if (res.data == "修改失败") {
                                wx.showToast({
                                        title: '修改失败，请重试',
                                        icon: 'none',
                                        duration: 2000,
                                })
                         }
                 }
               })
        }
})

 // wx.navigateTo({
                //   url: '../../../login/login',
                // })